package 素数判定.丑数;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * TODO
 *
 * @className: cs
 * @description: TODO
 * @author: 等什么柠檬君
 * @date: 2022-05-06 13:43
 **/
public class cs {
    /**
     * 此题暂时没做出来
     * @param args
     */
    public static void main(String[] args) {
        System.out.println(nthUglyNumber(11));
    }
    public static int nthUglyNumber(int n) {
        int count = 0;
        int[] result = {1, 2, 3, 4, 5, 6, 8, 9, 10, 12};
        if (n <= 10){
            return result[n-1];
        }

        for (int i = 2,data = 2;; ++i,++data) {
            System.out.println("当前数据 "+data);
            while (i % 2 == 0){
                i /= 2;
            }
            while (i % 3 == 0){
                i /= 3;
            }
            while (i % 5 == 0){
                i /= 5;
            }
            if (i == 1){
                ++count;
            System.out.println("正确的结果 "+data);
            System.out.println("正确的结果数量 "+count);
                System.out.println();
                if (count == n){
                    return data;
                }

            }
        }
    }
}
